home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Just Call Me Internet
/
Just Call Me Internet.iso
/
prog
/
atari
/
m2
/
cat3src
/
putz
/
putzacti.i
< prev
next >
Wrap
Text File
|
1997-10-26
|
13KB
|
443 lines
IMPLEMENTATION MODULE PutzAction;
(* In diesem Modul laufen die Ausgaben des Putzes zusammen
* Es wird ein Dialog in einem Fenster dargestellt, und
* die Ausgaben werden ber die Rechteckliste mit den
* get&set-Modus von wind_update gemacht
*)
FROM SYSTEM IMPORT ADDRESS, ADR, CADR, CAST, ASSEMBLER;
(* MM2-Module *)
IMPORT GrafBase;
(* CAT-Module *)
IMPORT WdwManager, CatGlobal;
FROM Void IMPORT v;
(* Magic-Module *)
IMPORT MagicSys, MagicAES, MagicStrings, mtUtils, mtAppl, mtAlerts, mtDials;
(* Putz-Module *)
IMPORT Catputz2;
CONST puffStr = ' Puffere Dateien '+0C;
chkStr = ' Prfe Nachrichten '+0C;
delStr = ' Lsche Nachrichten '+0C;
linkStr = ' Verkettung neu aufbauen '+0C;
copyStr = ' Dateien umkopieren ' + 0C;
spaceStr= ' '+0C;
VAR puffPtr,
chkPtr,
delPtr,
linkPtr,
copyPtr,
spacePtr : POINTER TO ARRAY [0..255] OF CHAR;
VAR rect : GrafBase.Rectangle;
inWindow: BOOLEAN;
wdwHandle: INTEGER;
oldNewTop: WdwManager.handleNewTopProc;
actBox : mtUtils.tObjcTree;
vr : GrafBase.Rectangle;
PROCEDURE bProc (wdw, vdi : INTEGER; env : ADDRESS; mx, my : INTEGER; kstate, buts : BITSET; clicks :INTEGER): BOOLEAN;
BEGIN
RETURN FALSE;
END bProc;
PROCEDURE kProc (wdw, vdi : INTEGER; env: ADDRESS; taste: INTEGER; key, scan : CHAR; kstate : BITSET): BOOLEAN;
BEGIN
RETURN FALSE
END kProc;
PROCEDURE closeP (wdw, vdi: INTEGER; env : ADDRESS; force : BOOLEAN): BOOLEAN;
BEGIN
RETURN force
END closeP;
PROCEDURE topP (wdw, vdi: INTEGER; env: ADDRESS): BOOLEAN;
BEGIN
RETURN TRUE
END topP;
PROCEDURE untopP (wdw, vdi: INTEGER; env: ADDRESS);
END untopP;
PROCEDURE setWork (wdw, vdi: INTEGER; env: ADDRESS; doc: GrafBase.LongRect; slided: BOOLEAN);
END setWork;
PROCEDURE getRect (wdw, vdi: INTEGER; env: ADDRESS; VAR r : GrafBase.Rectangle);
BEGIN
rect := r;
actBox^[0].obX := r.x;
actBox^[0].obY := r.y;
END getRect;
PROCEDURE redrawInfo (wdw, vdi : INTEGER; env : ADDRESS; clip : GrafBase.Rectangle);
BEGIN
mtDials.DialDraw (env, 0, 8, clip, TRUE);
END redrawInfo;
PROCEDURE updateP (wdw, vdi: INTEGER; env: ADDRESS; doIt: BOOLEAN);
BEGIN
IF doIt
THEN
MagicAES.WindUpdate (MagicAES.BEGUPDATE);
ELSE
MagicAES.WindUpdate (MagicAES.ENDUPDATE);
END;
END updateP;
VAR slideVars : RECORD
pFrame,
sFrame : mtUtils.tRect;
lastWidth : INTEGER;
reinit : BOOLEAN;
fullInit : BOOLEAN;
Epp : LONGINT;
END;
actParm : RECORD
msgTotal : LONGINT;
msgDone : INTEGER;
actMode : INTEGER;
END;
PROCEDURE handleBusyMouse();
BEGIN
IF ~CatGlobal.multiTask OR ~inWindow THEN
IF WdwManager.IsOwnTop ()
THEN
CatGlobal.busyMouse;
END;
END;
END handleBusyMouse;
PROCEDURE DrawObjectInWdw (tree: ADDRESS; obj, depth: INTEGER; r: GrafBase.Rectangle; clip: BOOLEAN; mouse: BOOLEAN): BOOLEAN;
BEGIN
IF ~clip
THEN
mtUtils.CalcArea (tree, obj, r);
END;
IF inWindow
THEN
IF CatGlobal.multiTask
THEN
MagicAES.WindUpdate (MagicAES.BEGUPDATE+$100);
ELSE
MagicAES.WindUpdate (MagicAES.BEGUPDATE);
END;
IF MagicAES.CallResult = 1
THEN
WdwManager.RedrawWdw (wdwHandle, r);
IF mouse
THEN
handleBusyMouse();
END;
MagicAES.WindUpdate (MagicAES.ENDUPDATE);
ELSE
IF mouse THEN mtAppl.MouseArrow(); END;
RETURN FALSE
END;
ELSE
mtDials.DialDraw (tree, 0, depth, r, clip);
END;
RETURN TRUE;
END DrawObjectInWdw;
PROCEDURE InitInfoSlider();
VAR tmp : BITSET;
BEGIN
WITH slideVars DO
(* slider anpassen an charWidth und charHeight *)
mtUtils.ObjcRect (actBox, Infobar, pFrame);
mtUtils.ObjcRect (actBox, Infoslid, sFrame);
(* Space berechnen *)
pFrame.h := mtAppl.CharHeight;
sFrame.h := mtAppl.CharHeight;
sFrame.w := 1;
Epp := (LONGINT(actParm.msgTotal*1000L) DIV LONG(pFrame.w));
mtUtils.SetObjcRect (actBox, Infobar, pFrame);
mtUtils.SetObjcRect (actBox, Infoslid, sFrame);
lastWidth := 0;
reinit := TRUE;
fullInit := TRUE;
END;
(* Fllstil auf Solid und Farbe setzen, falls Farbe *)
IF mtAppl.Bitplanes > 1
THEN
tmp := actBox^[Infoslid].obSpec.Box.flags;
tmp := tmp - {0..6} + {4..6} + {1};
actBox^[Infoslid].obSpec.Box.flags := tmp;
END;
END InitInfoSlider;
PROCEDURE CalcInfoSlider (msgCount : LONGCARD);
VAR oldW : INTEGER;
r : GrafBase.Rectangle;
startOb,
depth : INTEGER;
BEGIN
WITH slideVars DO
WITH sFrame DO
IF Epp > 0
THEN
w := SHORT((VAL(LONGINT,msgCount)*1000L) DIV Epp);
ELSE
w := pFrame.w
END;
IF x+w > pFrame.w THEN w := pFrame.w END;
IF w<=0 THEN w := 1 END;
IF (lastWidth # w) OR reinit THEN
mtUtils.SetObjcRect (actBox, Infoslid, sFrame);
mtUtils.ObjcArea (actBox, Infoslid, r);
IF ~reinit
THEN
r.x := r.x + lastWidth;
r.w := r.w - lastWidth + 1;
ELSE
mtUtils.ObjcArea (actBox, Infobar, r);
END;
IF fullInit THEN
startOb := 0;
depth := 8;
mtUtils.ObjcArea (actBox, 0, r);
ELSE
startOb := Infobar;
depth := 1;
END;
IF DrawObjectInWdw (actBox, startOb, depth, r, TRUE, (msgCount+1) MOD 10 = 0)
THEN
lastWidth := sFrame.w;
reinit := FALSE;
fullInit := FALSE;
END;
END;
END;
END;
END CalcInfoSlider;
PROCEDURE ReInitActionBox (REF grName : ARRAY OF CHAR; msgCount : LONGCARD);
BEGIN
actParm.msgTotal := VAL(LONGINT,msgCount);
mtUtils.SetObjcString (actBox, Acgrname, ' ');
mtUtils.SetObjcString (actBox, Acpufsta, ' ');
mtUtils.SetObjcString (actBox, Acgrname, grName);
InitInfoSlider();
actParm.actMode := -1;
v.bool := DrawObjectInWdw (actBox, 0, 8, vr, FALSE, TRUE);
END ReInitActionBox;
PROCEDURE BeginNextPass(mode: INTEGER);
BEGIN
InitInfoSlider();
actParm.actMode := mode;
CASE actParm.actMode OF
0 : mtUtils.SetObjcStringAdr (actBox, Acmsgid, puffPtr); |
1 : mtUtils.SetObjcStringAdr (actBox, Acmsgid, delPtr); |
2 : mtUtils.SetObjcStringAdr (actBox, Acmsgid, linkPtr); |
3 : mtUtils.SetObjcStringAdr (actBox, Acmsgid, copyPtr); |
4 : mtUtils.SetObjcStringAdr (actBox, Acmsgid, chkPtr); |
ELSE
mtUtils.SetObjcStringAdr (actBox, Acmsgid, spacePtr);
END;
v.bool := DrawObjectInWdw (actBox, 0, 8, vr, FALSE, TRUE);
END BeginNextPass;
PROCEDURE checkMouse (wdw: INTEGER);
VAR w, v : INTEGER;
BEGIN
WdwManager.GetTopWindow (w, v);
IF ~WdwManager.IsOwnTop() & ~CatGlobal.multiTask
THEN
mtAppl.MouseArrow();
END;
END checkMouse;
(* Init der Action-Box: Es werden alle notwendigen festen Strings berechnet,
* die variablen Strings werden gelscht und die Box wird gezeichnet.
* Der Prozentbalken wird auf 0% gesetzt und auch gezeichnet
*)
PROCEDURE InitActionBox ();
VAR full : GrafBase.Rectangle;
comps: BITSET;
oldFrame: CHAR;
BEGIN
mtUtils.SetObjcString (actBox, Acgrname, ' ');
mtUtils.SetObjcString (actBox, Acpufsta, ' ');
mtUtils.SetObjcString (actBox, Acgrname, ' ');
InitInfoSlider();
(* Outlined abschalten und Rand auf 1 Pixel setzen *)
mtUtils.ExclFlag (actBox, 0, MagicAES.OUTLINED);
oldFrame := actBox^[0].obSpec.Box.frame;
actBox^[0].obSpec.Box.frame := CAST(CHAR, -1);
mtDials.DialCenter (actBox, mtDials.CSCREEN, 0, 0, rect);
mtUtils.ObjcArea (actBox, 0, rect);
(* Jetzt Fenster fr Box ffnen *)
comps := {MagicAES.NAME, MagicAES.MOVE};
MagicAES.WindCalc (MagicAES.WCBORDER, comps, rect, full);
IF full.y < WdwManager.deskSize.y THEN full.y := WdwManager.deskSize.y END;
IF full.x < WdwManager.deskSize.x THEN full.x := WdwManager.deskSize.x END;
IF WdwManager.OpenWindow (bProc, kProc, WdwManager.handleTimerProc (NIL),
full, full, comps,
FALSE, '', 'CATPUTZ', WdwManager.snapProc (NIL),
closeP, redrawInfo, topP,
untopP, updateP, setWork, getRect,
WdwManager.hideProc(NIL), 0, actBox,
TRUE, TRUE, FALSE, FALSE, wdwHandle, v.int)
THEN
inWindow := TRUE;
WdwManager.FullRedrawWdw (wdwHandle);
oldNewTop := WdwManager.handleNewTop;
WdwManager.handleNewTop := checkMouse;
ELSE
inWindow := FALSE;
mtUtils.InclFlag (actBox, 0, MagicAES.OUTLINED);
actBox^[0].obSpec.Box.frame := oldFrame;
MagicAES.WindUpdate (MagicAES.BEGUPDATE);
mtDials.DialCenter (actBox, mtDials.CSCREEN, 0, 0, rect);
mtDials.DialForm (actBox, mtDials.DSTART, rect, rect);
mtDials.DialDraw (actBox, 0, 5, rect, FALSE);
END;
handleBusyMouse();
END InitActionBox;
PROCEDURE ShowBuffStatus (tabBuff, parBuff, datBuff : BOOLEAN);
VAR str : ARRAY [0..60] OF CHAR;
BEGIN
str := 0C;
IF tabBuff
THEN
MagicStrings.Append ("TAB gepuffert", str);
END;
IF parBuff
THEN
IF tabBuff THEN MagicStrings.Append (", ", str) END;
MagicStrings.Append ("PAR gepuffert", str);
END;
IF datBuff
THEN
IF tabBuff OR parBuff THEN MagicStrings.Append (", ", str) END;
MagicStrings.Append ("DAT gepuffert", str);
END;
IF ~tabBuff & ~parBuff & ~datBuff
THEN
MagicStrings.Assign ("nichts gepuffert", str);
END;
mtUtils.SetObjcString (actBox, Acpufsta, str);
v.bool := DrawObjectInWdw (actBox, Acpufsta, 1, vr, FALSE, TRUE);
END ShowBuffStatus;
PROCEDURE ReleaseActionBox();
BEGIN
IF inWindow
THEN
inWindow := FALSE;
v.bool := WdwManager.CloseWindow (wdwHandle, TRUE);
wdwHandle := -1;
WdwManager.handleNewTop := oldNewTop;
ELSE
mtDials.DialForm (actBox, mtDials.DFINISH, rect, rect);
MagicAES.WindUpdate (MagicAES.ENDUPDATE);
END;
mtUtils.SetObjcStringAdr (actBox, Acmsgid, spacePtr);
mtAppl.MouseArrow;
END ReleaseActionBox;
VAR mess : ARRAY [0..15] OF INTEGER;
PROCEDURE setMultiParam();
BEGIN
MagicAES.AESIntIn[0] := MagicSys.CastToInt (BITSET{MagicAES.MUMESAG, MagicAES.MUKEYBD, MagicAES.MUTIMER});
MagicAES.AESIntIn[14] := 0;
MagicAES.AESIntIn[15] := 0;
MagicAES.AESAddrIn[0] := ADR (mess);
END setMultiParam;
PROCEDURE terminate(): BOOLEAN;
VAR event : BITSET;
key : INTEGER;
scan : INTEGER;
BEGIN
setMultiParam();
event := MagicAES.EvntPmulti ();
IF MagicAES.MUMESAG IN event
THEN
v.bool := WdwManager.HandleEvent (event, mess, {}, {}, 0C, 0C, 0, 0, 0, 0);
END;
IF MagicAES.MUKEYBD IN event
THEN
key := MagicAES.AESIntOut[5];
ASSEMBLER
MOVE.W key(A6),D0
LSR.W #8,D0
MOVE.W D0,scan(A6)
END;
IF (scan = 1) OR ((key MOD 255) = $1B)
THEN RETURN TRUE
END;
END;
RETURN FALSE
END terminate;
PROCEDURE TellAction (actMode : INTEGER; msgCount : LONGCARD): BOOLEAN;
CONST stopAlert = "[2][Wollen Sie das Lschen|wirklich abbrechen?|Die aktuelle Gruppe|wird dann nicht mehr|weiter bearbeitet!][[Ja|[Nein]";
VAR res : INTEGER;
BEGIN
CalcInfoSlider(msgCount);
IF actMode # actParm.actMode
THEN
actParm.actMode := actMode;
mtUtils.SetObjcStringAdr (actBox, Acmsgid, spacePtr);
v.bool := DrawObjectInWdw (actBox, Acmsgid, 1, vr, FALSE, FALSE);
CASE actMode OF
0 : mtUtils.SetObjcStringAdr (actBox, Acmsgid, puffPtr); |
1 : mtUtils.SetObjcStringAdr (actBox, Acmsgid, delPtr); |
2 : mtUtils.SetObjcStringAdr (actBox, Acmsgid, linkPtr); |
3 : mtUtils.SetObjcStringAdr (actBox, Acmsgid, copyPtr); |
4 : mtUtils.SetObjcStringAdr (actBox, Acmsgid, chkPtr); |
ELSE
mtUtils.SetObjcStringAdr (actBox, Acmsgid, spacePtr);
END;
v.bool := DrawObjectInWdw (actBox, Acmsgid, 1, vr, FALSE, TRUE);
END;
IF terminate()
THEN
(* Sicherheitsabfrage *)
mtAppl.MouseArrow();
MagicAES.WindUpdate (MagicAES.BEGUPDATE);
mtAlerts.SetIconColor (MagicAES.BLUE);
res := mtAlerts.Alert (2, stopAlert);
mtAlerts.SetIconColor (MagicAES.BLACK);
MagicAES.WindUpdate (MagicAES.ENDUPDATE);
IF res = 1
THEN
RETURN FALSE
END;
handleBusyMouse();
END;
RETURN TRUE
END TellAction;
PROCEDURE InitModule (tree: ADDRESS);
(* Mu am Anfang aufgerufen werden, damit das Modul die Adresse
* des Baumes hat
*)
BEGIN
actBox := tree;
puffPtr := CADR(puffStr);
delPtr := CADR(delStr);
chkPtr := CADR(chkStr);
linkPtr := CADR(linkStr);
copyPtr := CADR(copyStr);
spacePtr := CADR(spaceStr);
END InitModule;
END PutzAction.